package com.xbongbong.pro.enums.smartsettings.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

/**
 * @description: 智能助手筛选条件枚举
 * @Author: hongxiao
 * @date: 2019-04-27 11:38
 * @since v1.0
 */
@Getter
public enum SmartSettingsConditionEnum {
    // 智能助手枚举
    /**
     * 提交时间/修改时间/期日
     */
    BEFORE("before", ">", "enum.smartSettingsCondition.memo.before"),
    NOW("now", "=", "enum.smartSettingsCondition.memo.now"),
    AFTER("after", "<", "enum.smartSettingsCondition.memo.after"),
    /**
     * 未跟进（客户/机会/供应商）、产品预警（仓库上限或下限）
     */
    EQUAL_CONDITION("equalcondition", "=", "enum.smartSettingsCondition.memo.equal_condition"),
    NOEQUAL_CONDITION("noequalcondition", "<>", "enum.smartSettingsCondition.memo.noequal_condition"),
    ;

    /**
     * 条件
     */
    private String symbol;

    /**
     * 将条件替换成符号
     */
    private String replaceSymbol;

    /**
     * 描述
     */
    private String memo;

    SmartSettingsConditionEnum(String symbol, String replaceSymbol, String memo){
        this.symbol = symbol;
        this.replaceSymbol = replaceSymbol;
        this.memo = memo;
    }

    public static SmartSettingsConditionEnum getBySymbol(String symbol) {
        for (SmartSettingsConditionEnum e : values()) {
            if (e.getSymbol().equals(symbol)) {
                return e;
            }
        }
        return null;
    }

    public String getMemo() {
        return I18nMessageUtil.getMessage(memo);
    }
}
